{extend name="main"}
{block name="style"}
<style type="text/css">
	.flex-lable{width: 100px;color: #6c757d;text-align: right;padding-right: 10px;}
	.w-100px{width: 100px;}
	.el-tag+.el-tag{
		margin-left: 10px;
	}
</style>
{/block}
{block name="body"}
<div class="bg-white mb-3">
	<el-form :model="search" @submit.native.prevent="submitForm" ref="search" label-position="right" class="flex py-3">

	  <el-form-item label="搜索类型" prop="search_type" class="flex mb-0 pl-3">
	  	<el-select v-model="search.search_type" placeholder="请选择" class="w-100px">
		    <el-option key="uid"label="UID"value="uid"></el-option>
		    <el-option key="user"label="用户名"value="user"></el-option>
		    <el-option key="mobile"label="手机号"value="mobile"></el-option>
		    <el-option key="email"label="邮箱"value="email"></el-option>
		</el-select>
	  </el-form-item>

<!--	  <el-form-item label="状态" prop="status" class="flex mb-0 pl-3">-->
<!--	  	<el-select v-model="search.status" placeholder="请选择" class="w-100px">-->
<!--		    <el-option key="all"label="全部"value="all"></el-option>-->
<!--		    <el-option :key="1"label="正常":value="1"></el-option>-->
<!--		    <el-option :key="0"label="禁用":value="0"></el-option>-->
<!--		</el-select>-->
<!--	  </el-form-item>-->

<!--	  <el-form-item label="身份" prop="role_type" class="flex mb-0 pl-3">-->
<!--	  	<el-select v-model="search.role_type" placeholder="请选择" class="w-100px">-->
<!--		    <el-option key="all"label="全部"value="all"></el-option>-->
<!--		    <el-option :key="1"label="企业":value="1"></el-option>-->
<!--		    <el-option :key="0"label="个人":value="0"></el-option>-->
<!--		</el-select>-->
<!--	  </el-form-item>-->

	  <el-form-item :label="getSearchType()" prop="key" class="flex mb-0 pl-3">
	    <el-input v-model="search.key" placeholder="请输入你想搜索的关键词"></el-input>
	  </el-form-item>

	  <el-form-item class="flex mb-0 pl-3">
	    <el-button type="primary" @click="initHtml">查询</el-button>
	    <el-button @click="resetForm('search')">重置</el-button>
		<el-link style="margin-left: 10px" :underline="false" type="primary" @click="isShowForm()" @click.native="iconArrow()">高级查询<i :class="DownIcon"></i></el-link>
	  </el-form-item>
	</el-form>

	<div style="box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1)" >
		<el-tag
				v-for="tag in AdvancedSearchForm"
				:key="tag.title"
				size="small"
				disable-transitions="true"
				closable
				type="warning"
				@close="handleClose(tag)">
			{{tag.title}}
		</el-tag>
	</div>

	<!--	高级搜索条件的开始-->
	<el-form v-if="iShowAdvancedSearchForm" label-width="120px" :model="AdvancedSearchForm" label-width="80px" style ="box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04)" id="RemoveDots" >
		<!--		状态条件开始-->
		<el-form-item label="用户状态：" size="mini" ref="statusIts" >
			<el-radio-group  v-model="userStatus"  @change="advancedSearchRadioChange('statusIts','userStatus')">
				<el-radio-button     v-for="v in statusIts" :label="v.value">{{v.title}}</el-radio-button>
			</el-radio-group>
		</el-form-item>
		<!--		状态条件结束-->

		<!--身份条件开始-->
		<el-form-item label="用户身份：" size="mini"  ref="identityIts">
			<el-radio-group  v-model="userIdentity" ref="vid" @change="advancedSearchRadioChange('identityIts','userIdentity')">
				<el-radio-button  v-for="v in identityIts" :label="v.value">{{v.title}}</el-radio-button>
			</el-radio-group>
		</el-form-item>
		<!--身份条件的结束-->

		<!--最近登录时间条件开始-->
		<el-form-item label="最近登录：" size="mini"  ref="recentLoginIts">
			<el-radio-group  v-model="RecentLogin"    @change="advancedSearchRadioChange('recentLoginIts','RecentLogin')">
				<el-radio-button    v-for="v in recentLoginIts" :label="v.value">{{v.title}}</el-radio-button>

			</el-radio-group>
		</el-form-item>
		<!--	最近登录条件的结束-->

		<!--最近注册时间条件开始-->
		<el-form-item label="最近注册：" size="mini"  ref="recentlyRegisteredIts">
			<el-radio-group  v-model="RecentlyRegistered"   @change="advancedSearchRadioChange('recentlyRegisteredIts','RecentlyRegistered')">
				<el-radio-button     v-for="v in recentlyRegisteredIts" :label="v.value">{{v.title}}</el-radio-button>

			</el-radio-group>
		</el-form-item>
		<!--最近注册时间条件的结束-->

		<!--来源条件开始-->
		<el-form-item label="数据来源：" size="mini" ref="sourceIts" >
			<el-radio-group  v-model="source"    @change="advancedSearchRadioChange('sourceIts','source')">
				<el-radio-button     v-for="v in sourceIts" :label="v.value">{{v.title}}</el-radio-button>
			</el-radio-group>
		</el-form-item>
		<!--来源条件的结束-->
		<el-divider><el-button type="text" @click="isNotShowForm()">收起高级查询</el-button></el-divider>
	</el-form>

</div>
<div class="bg-white p-3">
	<div class="table-responsive py-3">
		  <el-button type="primary" size="mini" @click="window.open('/user/addUser')" plain>手动添加用户</el-button>
	</div>
	<div class="table-responsive">
		<el-table
	      	:data="tableData"
    		v-loading="search.ajax"
    		style="width: 100%;"
    		header-cell-class-name="table-header-DDE6FB"
    		@expand-change="getUserInfo">
    		<el-table-column type="expand" width="20">
		      <template slot-scope="scope">
		      	<div class="flex" v-if="scope.row.user_info==1">
		      		<div class="flex-1">
		      			<div class="flex flex-center pb-3">
		      				<div class="flex-lable">UID</div>
		      				<div class="flex-1">{{scope.row.data.id}}</div>
		      			</div>
		      			<div class="flex flex-center pb-3">
		      				<div class="flex-lable">用户</div>
							<el-image
							  	v-if="scope.row.data.headimg" 
							    style="width: 30px; height: 30px"
							    lazy
							    class="rounded-circle mr-2"
							    :src="scope.row.data.headimg" 
							    :preview-src-list="[scope.row.data.headimg]">
							</el-image>
		      				<div class="flex-1">
								{{scope.row.data.nickname}}
		      				</div>
		      			</div>
		      			<div class="flex flex-center pb-3">
		      				<div class="flex-lable">账号</div>
		      				<div class="flex-1">{{scope.row.data.user}}</div>
		      			</div>
		      			<div class="flex flex-center pb-3">
		      				<div class="flex-lable">手机号</div>
		      				<div class="flex-1">{{scope.row.data.mobile}}</div>
		      			</div>
		      			<div class="flex flex-center pb-3">
		      				<div class="flex-lable">邮箱</div>
		      				<div class="flex-1">{{scope.row.data.email}}</div>
		      			</div>
		      			<div class="flex flex-center pb-3">
		      				<div class="flex-lable">实名</div>
		      				<div class="flex-1" v-if="scope.row.data.name">{{scope.row.data.name}} {{scope.row.data.idcard}}</div>
		      				<div class="flex-1 text-secondary" v-else="scope.row.data.name">未实名</div>
		      			</div>
		      			<div class="flex flex-center pb-3">
		      				<div class="flex-lable">当前身份</div>
		      				<div class="flex-1 text-primary" 
		      				v-if="scope.row.data.role_type">企业</div>
		      				<div class="flex-1 text-success" 
		      				v-else="scope.row.data.role_type">个人</div>
		      			</div>
		      			<div class="flex flex-center pb-3" v-if="scope.row.data.pid">
		      				<div class="flex-lable">上级</div>
		      				<div>
								<el-image
								  	v-if="scope.row.data.pheadimg" 
								    style="width: 30px; height: 30px"
								    lazy
								    class="rounded-circle mr-2"
								    :src="scope.row.data.pheadimg" 
								    :preview-src-list="[scope.row.data.pheadimg]">
								</el-image>
							</div>
		      				<div class="flex-1">
								{{scope.row.data.pid}}{{scope.row.data.pnickname}}
		      				</div>
		      			</div>
		      			<div class="flex flex-center pb-3">
		      				<div class="flex-lable">绑定QQ</div>
		      				<el-link
		      				v-if="scope.row.data.bind_qq"
		      				type="primary"
		      				:underline="false">{{scope.row.data.bind_qq.nickname}}</el-link>
		      				<el-link
		      				v-else
		      				type="info"
		      				:underline="false">未绑定</el-link>
		      			</div>
		      			<div class="flex flex-center pb-3">
		      				<div class="flex-lable">绑定微信</div>
		      				<el-link
		      				v-if="scope.row.data.bind_wx"
		      				type="primary"
		      				:href="'/wxUser?uid='+scope.row.id"
		      				target="_blank"
		      				:underline="false">{{scope.row.data.bind_wx.nickname}}</el-link>
		      				<el-link
		      				v-else
		      				type="info"
		      				:underline="false">未绑定</el-link>
		      			</div>
		      			<div class="flex flex-center pb-3">
		      				<div class="flex-lable">绑定AppleID</div>
		      				<el-link
		      				v-if="scope.row.data.bind_apple"
		      				type="primary"
		      				:underline="false">已绑定</el-link>
		      				<el-link
		      				v-else
		      				type="info"
		      				:underline="false">未绑定</el-link>
		      			</div>
		      			<div class="flex flex-center pb-3">
		      				<div class="flex-lable">禁用消息</div>
		      				<div class="flex-1">{{scope.row.data.disable_msg}}</div>
		      			</div>
		      			<div class="flex flex-center pb-3">
		      				<div class="flex-lable"></div>
		      				<div class="flex-1">
					        <el-button
					            type="info"
					            size="minism"
					            @click="window.open('/user/loginLog?uid='+scope.row.id)">
					            登录日志
					        </el-button>
					        <el-button
					            type="info"
					            size="minism"
					            @click="window.open('/user/apiLog?uid='+scope.row.id)">
					            操作日志
					        </el-button>
		      				</div>
		      			</div>
		      		</div>
		      		<div class="flex-1">
		      			<el-timeline>
						    <el-timeline-item 
						    :timestamp="scope.row.data.register_time" >
						        <h6>注册</h6>
						        <p class="mb-0 text-secondary small">{{scope.row.data.register_ip}}</p>
						        <p class="mb-0 text-secondary small">{{scope.row.data.register_devices}}</p>
						    </el-timeline-item>
						    <el-timeline-item 
						    :timestamp="scope.row.data.update_time">
						        <h6>账户</h6>
						    </el-timeline-item>
						    <el-timeline-item 
						    :timestamp="scope.row.data.info_update_time">
						        <h6>资料</h6>
						    </el-timeline-item>
						    <el-timeline-item 
						    :timestamp="scope.row.data.login_time">
						        <h6>最后登录</h6>
						        <p class="mb-0 text-secondary small">{{scope.row.data.login_ip}}</p>
						        <p class="mb-0 text-secondary small">{{scope.row.data.login_devices}}</p>
						    </el-timeline-item>
						    <el-timeline-item 
						    :timestamp="scope.row.data.online_time">
						        <h6>最后在线</h6>
						        <p class="mb-0 text-secondary small">{{scope.row.data.online_ip}}</p>
						        <p class="mb-0 text-secondary small">{{scope.row.data.online_devices}}</p>
						    </el-timeline-item>
						</el-timeline>
		      		</div>
		      	</div>
		      	<div class="text-center py-5 text-secondary small" v-else-if="scope.row.user_info==0">
		      		<i class="el-icon-loading mr-2"></i>加载中...
		      	</div>
		      	<div class="text-center py-5 text-secondary small" v-else="scope.row.user_info">
		      		未获取到用户信息
		      	</div>
		      </template>
		    </el-table-column>
	      <el-table-column
	        prop="id"
	        label="UID"
	        width="100">
	      </el-table-column>
	      <el-table-column
	        label="用户/账号"
	        min-width="180">
		      <template slot-scope="scope">
		      	<div class="flex flex-center">
					<el-image
					  	v-if="scope.row.headimg" 
					    style="width: 30px; height: 30px"
					    lazy
					    class="rounded-circle mr-2"
					    :src="scope.row.headimg" 
					    :preview-src-list="[scope.row.headimg]">
					</el-image>
		      		<div>
				      	<el-link @click="openWinTo(scope.row)" target="_blank"
				      	:underline="false"
				      	title="免登录跳转至用户中心">{{scope.row.nickname}}</el-link>
		          		<div>{{ scope.row.user }}</div>
		      		</div>
		      	</div>
		      </template>
	      </el-table-column>
	      <el-table-column
	        label="手机号/邮箱"
	        width="240">
		      <template slot-scope="scope">
		      	<div>
		          <div>{{ scope.row.mobile }}</div>
		          <div>{{ scope.row.email }}</div>
		      	</div>
		      </template>
	      </el-table-column>
	      <el-table-column
	        prop="app_name"
	        label="来源"
	        width="160">
	      </el-table-column>
	      <el-table-column
	        label="身份"
	        width="80">
		      <template slot-scope="scope">
		      	<div>
		      		<span class="text-primary" 
		      		v-if="scope.row.role_type==1">企业</span>
		      		<span class="text-info"
		      		v-else="scope.row.role_type==0">个人</span>
		      		<div class="text-small text-primary pointer"
		      		@click="toggleRoleType(scope.row)">转换身份</div>
						</div>
		      </template>
	      </el-table-column>
	      <el-table-column
	        label="实名"
	        width="80">
		      <template slot-scope="scope">
		      	<div>
		      		<span class="text-success" 
		      		v-if="scope.row.is_real_name==1">已实名</span>
		      		<span class="text-secondary"
		      		v-else="scope.row.is_real_name==0">未实名</span>
				</div>
		      </template>
	      </el-table-column>
	      <el-table-column
	        label="状态"
	        width="80">
		      <template slot-scope="scope">
		      	<transition>
		      		<el-button type="success" size="minism"
		      		v-if="scope.row.status==1 || scope.row.status==2" 
		      		@click="setStatus(scope.row);" 
		      		:loading="scope.row.status==2">正常</el-button>
		      		<el-button type="info" size="minism" 
		      		v-else="scope.row.status==0 || scope.row.status==2" 
		      		@click="setStatus(scope.row);" 
		      		:loading="scope.row.status==2">禁用</el-button>
				</transition>
		      </template>
	      </el-table-column>
	      <el-table-column
	        label="创建/更新时间"
	        width="180">
		      <template slot-scope="scope">
		      	<div class="small">
		          <div>{{ scope.row.create_time }}</div>
		          <div>{{ scope.row.update_time }}</div>
		      	</div>
		      </template>
	      </el-table-column>
	      <el-table-column
	        label="/"
	        width="120">
		      <template slot-scope="scope">
		        <el-button
		            type="success"
		            plain
		            round
		            size="minism"
		            v-if="scope.row.role_type"
		            :disabled="!scope.row.company_id"
		            @click="Business.openBusiness(scope.row.company_id,true)">
		            业务
		        </el-button>
		        <el-button
		            type="success"
		            plain
		            round
		            size="minism"
		            :disabled="!scope.row.resume_id"
		            v-else
		            @click="Business.openBusiness(scope.row.resume_id)">
		            业务
		        </el-button>
		        <el-button
		            type="primary"
		            plain
		            round
		            size="minism"
		            @click="window.open('/user/editUser/'+scope.row.id)">
		            编辑
		        </el-button>
		      </template>
	      </el-table-column>
	    </el-table>
	</div>
	<div class="table-responsive py-3 text-center">
		<el-pagination
		  background
	      @size-change="handleSizeChange"
	      @current-change="handleCurrentChange"
	      :current-page="search.page"
	      :page-sizes="[10,50,100,200]"
	      :page-size="search.pageSize"
	      layout="total, sizes, prev, pager, next, jumper"
	      :total="search.total">
	    </el-pagination>
	</div>
</div>
<el-dialog
  title="禁止登录"
  :visible.sync="dialogVisible"
  width="600px"
  :before-close="cancelRefuseWinSubmit">
	<el-form :model="disable_form" label-width="80px" :rules="rules" ref="disable_form" size="small">
		  <el-form-item label="禁用原因" prop="msg">
		    <el-input type="textarea" v-model="disable_form.msg" class="col-12 pl-0 pr-0" :autosize="{ minRows: 4, maxRows: 20}" maxlength="200" show-word-limit></el-input>
		  </el-form-item>
		  <el-form-item label="封禁期限" prop="auto_disable">
		    <el-date-picker
		      v-model="disable_form.auto_disable"
		      align="right"
		      type="date"
		      format="yyyy-M-d"
		      value-format="yyyy-M-d"
			    :picker-options="endPickerOptions"
		      placeholder="End Time">
		    </el-date-picker>
		  	<p class="small text-danger">自动解封期限</p>
		  </el-form-item>
	</el-form>
	<div class="pointer text-primary small py-1" @click="showLog= !showLog;">{{showLog?'收起日志':'查看日志'}}</div>
  	<div v-show="showLog" style="max-height:500px;overflow-y: auto;">
		<div class="py-2 border-bottom mb-2" v-for="(v,index) in UserFind.log">
			<div class="flex">
				<div class="text-success" v-if="v.status===1">解除封禁</div>
				<div class="text-danger" v-if="v.status===0">封号</div>
				<div class="flex-1 pl-2">{{v.nickname}}</div>
				<div class="small text-secondary">{{v.create_time}}</div>
			</div>
			<div class="pt-2">{{v.disable_msg}}</div>
			<div class="pt-2 small" v-if="v.auto_time">自动解封日期：{{v.auto_time}}<span v-if="v.auto_status" class="ml-1 text-success">已执行</span></div>
		</div>
  	</div>
	<div slot="footer">
	    <el-button @click="cancelRefuseWinSubmit">取 消</el-button>
	    <el-button type="primary" @click="submitDisable('disable_form');" :loading="disable_form.ajax">{{disable_form.ajax?'提交中...':'提交'}}</el-button>
	</div>
</el-dialog>
{/block}
{block name="script"}
<script type="text/javascript">
	{empty name="role"}
	var role=[];
	{else/}
	var role={:json_encode($role,JSON_UNESCAPED_UNICODE)};
	{/empty}
</script>
<script type="text/javascript">
	var vm=new Vue({
		el:'#app',
		data:{
			view:XYBase.view,
			role:role,
			labelPosition:'right',
			showLog:false,
			dialogVisible:false,
			//箭头方向，默认向下
			isDownIcon:true,
			DownIcon:"el-icon-arrow-down  el-icon--right",
			//是否显示高级搜索的表单
			iShowAdvancedSearchForm:false,
			//状态单选框，默认为全部
			userStatus:-1,
			//身份单选框，默认为全部
			userIdentity:-1,
			//最近登录单选框，默认为全部
			RecentLogin:-1,
			//最近注册单选框，默认为全部
			RecentlyRegistered:-1,
			//来源单选框，默认为全部
			source:-1,
			statusIts:[
				{value:-1,title:"全部"},
				{value:1,title:"正常"},
				{value:0,title:"禁用"}
			],
			identityIts:[
				{value:-1,title:"全部"},
				{value:1,title:"企业"},
				{value:0,title:"个人"}
			],
			recentLoginIts:[
				{value:-1,title:"全部"},
				{value:0,title:"今天"},
				{value:3,title:"最近三天"},
				{value:7,title:"最近七天"},
				{value:30,title:"最近一个月"}
			],
			recentlyRegisteredIts:[
				{value:-1,title:"全部"},
				{value:0,title:"今天"},
				{value:3,title:"最近三天"},
				{value:7,title:"最近七天"},
				{value:30,title:"最近一个月"}
			],
			sourceIts:[
				{value:-1,title:"全部"},
				{value:1,title:"PC"},
				{value:4,title:"H5"},
				{value:6,title:"微信小程序"},
				{value:2,title:"APP"},
				{value:8,title:"抖音小程序"},
				{value:9,title:"百度小程序"},
				{value:10,title:"支付宝小程序"},
				{value:11,title:"快手小程序"},
				{value:null,title:"后台添加"},
			],

			//高级搜索的表单
			AdvancedSearchForm:[],

			UserFind:{},
		    endPickerOptions: {
		        disabledDate(time) {
		          return time.getTime() < Date.now();
		        },
		        shortcuts: [{
		            text: '1天',
		            onClick(picker) {
		              const date = new Date();
		              date.setTime(date.getTime() + 3600 * 1000 * 24);
		              picker.$emit('pick', date);
		            }
		        }, {
		            text: '3天',
		            onClick(picker) {
		              const date = new Date();
		              date.setTime(date.getTime() + 3600 * 1000 * 24 * 3);
		              picker.$emit('pick', date);
		            }
		        }, {
		            text: '7天',
		            onClick(picker) {
		              const date = new Date();
		              date.setTime(date.getTime() + 3600 * 1000 * 24 * 7);
		              picker.$emit('pick', date);
		            }
		        }, {
		            text: '15天',
		            onClick(picker) {
		              const date = new Date();
		              date.setTime(date.getTime() + 3600 * 1000 * 24 * 15);
		              picker.$emit('pick', date);
		            }
		        }, {
		            text: '30天',
		            onClick(picker) {
		              const date = new Date();
		              date.setTime(date.getTime() + 3600 * 1000 * 24 * 30);
		              picker.$emit('pick', date);
		            }
		        }]
		   	},
			disable_form:{
				ajax:false,
				msg:'',
				auto_disable:''
			},
	        rules: {
	          msg: [
	            { required: true, message: '请输入禁用原因', trigger: 'blur' },
	          ],
	        },
			search:{
				{notempty name=":request()->get('uid')"}
				search_type:'uid',
				key:'{:request()->get('uid')}',
				{elseif request()->get('user')/}
				search_type:'user',
				key:'{:request()->get('user')}',
				{elseif request()->get('mobile')/}
				search_type:'mobile',
				key:'{:request()->get('mobile')}',
				{elseif request()->get('email')/}
				search_type:'email',
				key:'{:request()->get('email')}',
				{else/}
				search_type:'uid',
				key:'',
				{/notempty}
				status:'all',
				role_type:'all',
				ajax:false,
				page:1,
				total:0,
				pageSize:10
			},
			tableData:[],
		},
		watch:{
		    view:XYBase.viewWatch,
		},
		created(){
			XYBase.created(this);
		},
	    methods: {
	    	toggleRoleType(row){
		        this.$confirm('确定将【'+row.nickname+'】的身份切换为【'+(row.role_type?'个人':'企业')+'】吗？', '提示', {
		        	dangerouslyUseHTMLString:true,
		          confirmButtonText: '切换',
		          cancelButtonText: '取消',
		          type: 'warning'
		        }).then(() => {
			    		$.getJSON('/user/setUserInfoRoleType/'+row.id+'/'+(row.role_type?0:1),function(ret){
			    			if (ret) {
			    				if (ret.code === 0) {
			    					row.role_type=row.role_type?0:1;
			    				}else{
			    					XYBase.msg(ret.msg);
			    				}
			    			}else{
								XYBase.error(XYBase.config.system_network_error);
			    			}
			    		});
		        }).catch(() => {
							XYBase.msg('已取消');
		        });
	    	},
	    	openWinTo(row){
		        this.$confirm('即将免登录打开【'+row.nickname+'】,是否继续？', '提示', {
		        	dangerouslyUseHTMLString:true,
		          confirmButtonText: '继续',
		          cancelButtonText: '取消',
		          type: 'warning'
		        }).then(() => {
	    			window.open('user/exemptLoginRedirect/'+row.id+'?path=/user');
		        }).catch(() => {
					XYBase.msg('已取消');
		        });
	    	},
	    	getSearchType(){
	    		var text='UID';
	    		switch(this.search.search_type){
	    			case 'uid':
	    				text='UID';
	    				break;
	    			case 'user':
	    				text='用户名';
	    				break;
	    			case 'mobile':
	    				text='手机号';
	    				break;
	    			case 'email':
	    				text='邮箱';
	    				break;
	    		}
	    		return text;
	    	},
			//点击显示高级表单按钮
			isShowForm:function(){
				this.iShowAdvancedSearchForm=!this.iShowAdvancedSearchForm;
				this.isDownIcon=!this.isDownIcon;
			},
			//鼠标悬停效果
			iconArrow:function(){
				if (this.isDownIcon){
					this.DownIcon="el-icon-arrow-down  el-icon--right";
				}else {
					this.DownIcon="el-icon-arrow-up  el-icon--right";
				}
			},
			//点击收起高级查询按钮
			isNotShowForm:function(){
				this.iShowAdvancedSearchForm=false;
			},
			//高级搜索选择条件的事件
			advancedSearchRadioChange(searchName,modeName){
				let _this = this;
				let title="";
				let isPush=true;
				let numData=_this[searchName];
				//获取当前条件的前缀
				getTitle = numData.map((item)=>{
					if (item.value==_this[modeName]){
						title= item.title;
					}
				})
				//判断当前条件的前缀是否存在
				_this.AdvancedSearchForm.forEach((item,index)=>{
					if (item.value==modeName){
						_this.AdvancedSearchForm.splice(index,1);
					}
					if (_this[item.value]==-1){
						_this.AdvancedSearchForm.splice(index,1);
						isPush=false;
					}
				})
				if (isPush){
					this.AdvancedSearchForm.push({
						title:_this.$refs[searchName].label+title,
						value:modeName,
						index:_this[modeName]
					})
				}
				// if (this.AdvancedSearchForm.length>0){
					//发起请求获取对应条件的列表数据
					this.advancedSearch();
				// }

			},
			//高级搜索条件标签关闭
			handleClose:function(tag){
				let _this = this;
				_this.AdvancedSearchForm.forEach((item,index)=>{
					if (item.value==tag.value){
						_this.AdvancedSearchForm.splice(index,1);
						_this[item.value]=-1;
					}
				})
				this.advancedSearch();
			},
	      	cancelRefuseWinSubmit(done){
	      		this.UserFind={};
	      		this.$refs.disable_form&&this.$refs.disable_form.resetFields();
	      		typeof done==='function'&&done();
				this.dialogVisible=false;
	      	},
	    	setStatus(data){
	    		if (data.status==2) return;
	    		if (data.status==1) {
	    			this.UserFind=data;
	    			this.dialogVisible=true;
	    		}else{
		    		var status=1,oldStatus=data.status;
		    		if (data.status) status=0;
		    		data.status=2;
		    		$.getJSON('/user/setStatus/'+data.id,function(ret){
		    			data.status=oldStatus;
		    			if (ret) {
		    				if (ret.code === 0) {
		    					data.status=status;
		    				}else{
		    					XYBase.msg(ret.msg);
		    				}
		    			}else{
							XYBase.error(XYBase.config.system_network_error);
		    			}
		    		});
	    		}
	    	},
	    	submitDisable(){
	    		var _this=this;
	    		if (this.UserFind.status==2) return;
	    		var status=1,oldStatus=this.UserFind.status;
	    		if (this.UserFind.status) status=0;
	    		this.UserFind.status=2;
	    		this.disable_form.ajax=true;
	    		$.ajax({
	    			url:'/user/setStatus/'+this.UserFind.id,
	    			data:this.disable_form,
	    			type:'post',
	    			dataType:'json',
	    			error:function(err) {
	    				_this.disable_form.ajax=false;
	    				_this.UserFind.status=oldStatus;
						XYBase.error(XYBase.config.system_network_error);
	    			},
	    			success:function(ret) {
	    				_this.disable_form.ajax=false;
		    			_this.UserFind.status=oldStatus;
		    			if (ret) {
		    				if (ret.code === 0) {
		    					_this.UserFind.status=status;
		    					_this.UserFind.disable_msg=_this.disable_form.msg;
		    					_this.cancelRefuseWinSubmit();
		    				}else{
		    					XYBase.msg(ret.msg);
		    				}
		    			}else{
							XYBase.error(XYBase.config.system_network_error);
		    			}
	    			}
	    		});
	    	},
			resetForm:function(formName) {
				this.$refs[formName].resetFields();
				this.AdvancedSearchForm.map((item)=>{
					this[item.value]=-1;
				})
				this.AdvancedSearchForm=[];
			},
			handleSizeChange(val) {
				this.search.page=1;
				this.search.pageSize=val;
	          	this.initHtml();
			},
			handleCurrentChange(val) {
				this.search.page=val;
	          	this.initHtml();
			},
			getUserInfo(row,expandedRows) {
				if (row.user_info)return;
	    		$.getJSON('/getUserInfo/'+row.id,function(ret){
	    			if (ret) {
	    				if (ret.code === 0) {
	    					row.user_info=1;
	    					row.data=ret.data;
	    				}else{
	    					row.user_info=2;
	    					XYBase.msg(ret.msg);
	    				}
	    			}else{
						XYBase.error(XYBase.config.system_network_error);
	    			}
	    		});
			},
	      	initHtml() {
	      		var _this=this;
	      		_this.search.ajax=true;
				$.ajax({
					url:'',
					type:'get',
					data:_this.search,
					dataType:'json',
					error:function(err){
	      				_this.search.ajax=false;
						XYBase.error(XYBase.config.system_network_error);
					},
					success:function(ret){
	      				_this.search.ajax=false;
						if (ret) {
							if (ret.code === 0) {
								_this.search.total=ret.data.total;
								_this.tableData=ret.data.data;
							}else{
								XYBase.msg(ret.msg);
							}
						}else{
							XYBase.error(XYBase.config.system_network_error);
						}
					}
				});
			},
			//高级搜索
			advancedSearch(){
				let _this=this;
				$.ajax({
					url:'user/advancedSearch',
					type:'post',
					data:{searchData:_this.AdvancedSearchForm,page:_this.search.page,pageSize:_this.search.pageSize,total:_this.search.total},
					dataType:'json',
					error:function(err){
						XYBase.error(XYBase.config.system_network_error);
					},
					success:function(ret){
						_this.search.ajax=false;
						if (ret) {
							if (ret.code === 0) {
								_this.search.total=ret.data.total;
								_this.tableData=ret.data.data;
							}else{
								XYBase.msg(ret.msg);
							}
						}else{
							XYBase.error(XYBase.config.system_network_error);
						}
					}
				});
			}
	    }
	});
	$(function(){
		vm.initHtml();
		reloadWindowSize();
		$(window).resize(function(){
			reloadWindowSize();
		});
	});
	function reloadWindowSize (argument) {
		var winW=$(window).width();
		if(winW <= 576){
			vm.labelPosition='top';
		}else{
			vm.labelPosition='right';
		}
	}
</script>
{include file="business"/}
{/block}